package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreCreditsLog;
import com.fujitsu.nanjing.tieba.ibator.CoreCreditsLogCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreCreditsLogDAOImpl extends SqlMapClientDaoSupport implements CoreCreditsLogDAO {

    public CoreCreditsLogDAOImpl() {
        super();
    }

    public int countByExample(CoreCreditsLogCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_credits_log.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreCreditsLogCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_credits_log.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer logid) {
        CoreCreditsLog _key = new CoreCreditsLog();
        _key.setLogid(logid);
        int rows = getSqlMapClientTemplate().delete("core_credits_log.deleteByPrimaryKey", _key);
        return rows;
    }

    public Integer insert(CoreCreditsLog record) {
        Object newKey = getSqlMapClientTemplate().insert("core_credits_log.insert", record);
        return (Integer) newKey;
    }

    public Integer insertSelective(CoreCreditsLog record) {
        Object newKey = getSqlMapClientTemplate().insert("core_credits_log.insertSelective", record);
        return (Integer) newKey;
    }

    @SuppressWarnings("unchecked")
    public List<CoreCreditsLog> selectByExample(CoreCreditsLogCriteria example) {
        List<CoreCreditsLog> list = getSqlMapClientTemplate().queryForList("core_credits_log.selectByExample", example);
        return list;
    }

    public CoreCreditsLog selectByPrimaryKey(Integer logid) {
        CoreCreditsLog _key = new CoreCreditsLog();
        _key.setLogid(logid);
        CoreCreditsLog record = (CoreCreditsLog) getSqlMapClientTemplate().queryForObject("core_credits_log.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreCreditsLog record, CoreCreditsLogCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_credits_log.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreCreditsLog record, CoreCreditsLogCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_credits_log.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreCreditsLog record) {
        int rows = getSqlMapClientTemplate().update("core_credits_log.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreCreditsLog record) {
        int rows = getSqlMapClientTemplate().update("core_credits_log.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreCreditsLogCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreCreditsLogCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}